package com.huawei.hms.framework.network.restclient.hwhttp.okhttp;

import com.huawei.hms.framework.common.Logger;
import com.huawei.hms.framework.network.restclient.hwhttp.HttpContants;
import com.huawei.hms.framework.network.restclient.hwhttp.RequestBody;
import java.io.IOException;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSocketFactory;
import o.ftt;
import o.fty;
import o.ftz;
import o.fua;
import o.fui.a;
import o.fum;
import o.fuo.d;
import o.fup;
import o.fur;
import o.fus;
import o.fut;
import o.fuv;
import o.fuy;
import o.fvb;
import o.fvv;
import o.fvz;
import o.fwe;
import o.fxv;
import okhttp3.internal.connection.RouteException;
import okhttp3.internal.connection.StreamAllocation;

public class OnlyConnectCall implements ftz {
    private static final String TAG = "OnlyConnectCall";
    private volatile boolean canceled;
    private fuv client;
    private fus request;

    public OnlyConnectCall(fuv o_fuv, fus o_fus) {
        this.client = o_fuv;
        this.request = o_fus;
    }

    private ftt createAddress(fur o_fur) {
        SSLSocketFactory ॱˊ;
        HostnameVerifier ͺ;
        fty o_fty = null;
        if (o_fur.ˎ()) {
            ॱˊ = this.client.ॱˊ();
            ͺ = this.client.ͺ();
            o_fty = this.client.ˏॱ();
        } else {
            ͺ = null;
            ॱˊ = null;
        }
        return new ftt(o_fur.ʻ(), o_fur.ॱॱ(), this.client.ʼ(), this.client.ˋॱ(), ॱˊ, ͺ, o_fty, this.client.ॱˋ(), this.client.ʽ(), this.client.ʽॱ(), this.client.ʿ(), this.client.ᐝ());
    }

    public fus request() {
        return this.request;
    }

    public fvb execute() throws IOException {
        fum create = this.client.ˋˊ().create(this);
        if (create != null) {
            create.callStart(this);
        }
        try {
            d o_fvz = new fvz(null, null, null, null, 0, request(), this, create, this.client.ˋ(), this.client.ˏ(), this.client.ॱ());
            StreamAllocation streamAllocation = new StreamAllocation(this.client.ʻॱ(), createAddress(request().ˏ()), this, o_fvz.ʽ(), null, this.client.ʼॱ());
            boolean z = !o_fvz.ˊ().ˋ().equals(HttpContants.HTTP_METHOD_GET);
            if (this.canceled) {
                throw new IOException("Canceled");
            }
            fvv newStream = streamAllocation.newStream(this.client, o_fvz, z);
            if (this.canceled) {
                streamAllocation.cancel();
                throw new IOException("Canceled");
            }
            if (newStream instanceof fwe) {
                newStream.ॱ();
            }
            streamAllocation.release();
            if (create != null) {
                create.responseBodyStart(this);
            }
            try {
                streamAllocation.streamFinished(false, newStream, 0, null);
            } catch (Throwable e) {
                Logger.w(TAG, "for okhttp 3.12, throw Exception, this may not bug", e);
            }
            if (!this.canceled) {
                return new fvb.d().ˎ(this.request).ॱ(fut.ˊ).ॱ(200).ॱ(new a().ˊ()).ˊ("connect success").ॱ(fuy.ˋ(fup.ˎ(RequestBody.DEFAULT_CONTENT_TYPE), "connect success")).ˏ();
            }
            streamAllocation.cancel();
            throw new IOException("Canceled");
        } catch (RouteException e2) {
            throw e2.ˋ();
        }
    }

    public void enqueue(fua o_fua) {
    }

    public void cancel() {
        this.canceled = true;
    }

    public synchronized boolean isExecuted() {
        return false;
    }

    public boolean isCanceled() {
        return this.canceled;
    }

    public fxv timeout() {
        return null;
    }

    public ftz clone() {
        return null;
    }
}
